package main

import (
	"fmt"
	"github.com/gin-gonic/gin"
	"strconv"
	"wrblog-api-go/config"
	"wrblog-api-go/pkg/docker"
	"wrblog-api-go/pkg/mylog"
	"wrblog-api-go/router"
)

func main() {
	//设置模式
	gin.SetMode(config.Conf.Server.Mode)
	r := router.InitRouter()
	// 初始化 docker client
	if err := docker.InitDockerClient(); err != nil {
		mylog.MyLog.Error("InitDockerClient error: ", err)
	}
	port := fmt.Sprintf(":%s", strconv.Itoa(config.Conf.Server.Port))
	if config.Conf.Server.Https {
		r.RunTLS(port, "", "")
	} else {
		r.Run(fmt.Sprintf(":%s", strconv.Itoa(config.Conf.Server.Port)))
	}

}
